load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//build:STRINGER.bzl", "stringer")

go_library(
    name = "quorum",
    srcs = [
        "config.go",
        "joint.go",
        "majority.go",
        "quorum.go",
        ":gen-voteresult-stringer",  # keep
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/raft/quorum",
    visibility = ["//visibility:public"],
    deps = ["//pkg/raft/raftpb"],
)

go_test(
    name = "quorum_test",
    srcs = [
        "bench_test.go",
        "datadriven_test.go",
        "quick_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":quorum"],
    deps = [
        "//pkg/raft/raftpb",
        "@com_github_cockroachdb_datadriven//:datadriven",
    ],
)

stringer(
    name = "gen-voteresult-stringer",
    src = "quorum.go",
    typ = "VoteResult",
)
